package com.dhl.deliver.controller;


import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.dhl.deliver.entity.Goods;
import com.dhl.deliver.entity.Product;
import com.dhl.deliver.service.IGoodsService;
import com.dhl.deliver.service.IProductService;
import com.dhl.deliver.utils.GridResultWrapper;
import com.dhl.deliver.utils.Result;
import com.dhl.deliver.utils.ResultUtil;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author dhl
 * @since 2020-07-15
 */
@RestController
@RequestMapping("/goods")
public class GoodsController {

    @Autowired
    IGoodsService goodsService;

    @ApiOperation("获取订单中的商品")
    @GetMapping("/getGoodsByOrderId")
    public Result getGoodsByOrderId(String id){
        Wrapper<Goods> wrapper=new QueryWrapper<Goods>().eq("order_id",id);
        List<Goods> list=goodsService.list(wrapper);
        return ResultUtil.success(list);
    }

}
